package dao;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;

import entity.Visitor;

public class VisitorDAO {
	public static boolean addVisitor(Visitor a){		
		Connection conn = connectUtil.ConnectionUtil.getConnection();
		try {
			CallableStatement cs=conn.prepareCall("{call addVisitor(?,?,?,?,?,?,?,?,?,?,?)}");
			cs.setString(1,	a.getUserName());
			cs.setString(2,	a.getPassword());
			cs.setString(3,	a.getFirstName());
			cs.setString(4,	a.getLastName());
			cs.setString(5,	a.getGender());
			cs.setString(6,	a.getTelephone());
			cs.setString(7,	a.getEmail());
			cs.setString(8,	a.getArea());
			cs.setString(9,a.getHobby());
			cs.setString(10,a.getDescription());
			cs.setBoolean(11, a.isRole());
			cs.executeUpdate();
			conn.close();
			return true;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}		
	}
}
